package com.bwie.controller;

import com.bwie.pojo.TbBrand;
import com.bwie.service.TbBrandService;
import com.bwie.utils.R;
import com.bwie.vo.PageInfoVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author: badaotianqiong
 * @Date: 2025/6/20 18:41
 * @Description:
 **/
@RestController
@RequestMapping("/shop/index")
public class ShopController {
    @Autowired
    private TbBrandService tbBrandService;

    @PostMapping("getBrandList")
    public R getBrandList(@RequestBody PageInfoVo pageInfoVo){
        return tbBrandService.getBrandList(pageInfoVo);
    }

    @PostMapping("addBrandList")
    public R addBrandList(@RequestBody @Validated TbBrand tbBrand){
        return tbBrandService.addBrandList(tbBrand);
    }

    @PostMapping("updateBrandStatus")
    public R updateBrandStatus(@RequestBody TbBrand tbBrand){
        return tbBrandService.updateBrandStatus(tbBrand);
    }

    @PostMapping("deleteBrand/{brandId}")
    public R deleteBrand(@PathVariable("brandId") Integer brandId){
        return tbBrandService.deleteBrand(brandId);
    }

    @PostMapping("deleteBatchBrand")
    public R deleteBatchBrand(@RequestBody List<TbBrand> tbBrandList){
        return tbBrandService.deleteBatchBrand(tbBrandList);
    }

    @PostMapping("getBrandData")
    public R getBrandData(){
        return tbBrandService.getBrandData();
    }
}
